<?php
require_once("Zend/Amf/Server.php");
require_once("Zend/Amf/Request/Http.php");

class AmfController extends AppController {
	var $name = 'Amf';
	var $uses = array();
	
	function index()
	{
		$server = new Zend_Amf_Server();
		
		$request = new Zend_Amf_Request_Http();
		
		$bodies = $request->getAmfBodies();
		
		$body = $bodies[0]->getData();
		if($body instanceof Zend_Amf_Value_Messaging_RemotingMessage)
		{
			App::import('Controller',	$body->source );
			
			$controllerName = $body->source . "Controller";
			
			$ctrlr =  new $controllerName();
			
			$server->setClass($ctrlr, $body->source);

		}
		
		$response = $server->handle();
		echo $response;
		die();

	}
	
	
	
}